package com.tianya.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;

/**
 * @author TianYaGuoKe
 * @date 2025/5/22 10:58
 * @description RoleName
 */
public enum RoleName {
    ADMIN(1L),
    TEACHER(2L),
    STUDENT(3L),
    PARENT(4L);
    @EnumValue
    private Long code;
    RoleName(Long code) {
        this.code = code;
    }

    //根据code获取枚举
    public static RoleName getByCode(Long code) {
        for (RoleName value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
